package hn.cch.pattern.singleton;

/**
 * 单例模式
 */
public class SingletonPattern {

    private static SingletonPattern instance = null;

    private SingletonPattern() {

    }

    public SingletonPattern getInstance() {
        if (instance != null) {
            return instance;
        }
        synchronized (SingletonPattern.class) {
            if (instance == null) {
                instance = new SingletonPattern();
            }
        }
        return instance;
    }
}
